<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>Document</title>
</head>
<body>
        <div id="app">
                <h2>{{name}}</h2>
                <h1>{{newstr}}</h1>
                <button @Click="revocer">字符串反转</button>
        </div>
        
        <script>
            var vue = new Vue({
                el:"#app",
                data: {
                    name:"雕沙是的读来过倒",
                    newstr:""
                },
                methods: {
                    revocer() {
                        var length = this.name.length;

                        for(var i = length-1; i>= 0 ; i--){
                            this.newstr += this.name[i];
                        }
                    }
                }
            })
        </script>
</body>
</html>